The present invention relates to a rounding unit, and more particularly to a rounding unit for use in the arithmetic processing operation of floating point data.
Floating point data includes by an exponent part and a mantissa part. That is, floating point data A is represented by M.times.2.sup.E where E represents the exponent part and M indicates the mantissa part. When floating point data are processed by an arithmetic unit, their exponent parts and mantissa parts are in general independently processed, respectively.
In the arithmetic processing operation of floating point data, however, mantissa part data which have a data length exceeding the predetermined word length for the mantissa part are often treated. For example, in the case of the multiplication of floating point data, multiplication is conducted with the mantissa parts and possibly results in a data having a data length twice longer than the word length which is predetermined for the mantissa part. Thus, an operation for adjusting the data length of the resulted mantissa part data with the predetermined word length is required to complete the processing. Such an operation is called "rounding operation".
The computer which processes floating point data is usually equipped with a means which can temporarily store the data underflowing the least significant bit of the mantissa part. In accordance with the ordered rounding mode, the underflowing data is rounded by, for example, raising or truncating the same, to complete the arithmetic processing operation.
The rounding mode includes a rounding to a nearest value, a rounding in the negative direction, a rounding in the positive direction, and a rounding in the direction toward zero. But the rounding operation includes only two cases, that is to raise one unit to the place of the least significant bit of the mantissa part and to truncate the value underflowing the least significant bit of the mantissa part. Namely, the rounding operation can be summarized as modifying the result of the arithmetic operation by adding "1" to the least significant bit of the mantissa part or truncating the underflowing value, depending upon the mode of rounding operation and the result of the arithmetic processing.
However, there is an exception which can not be summarized as above. Such an exception is illustrated in FIG. 1. In this exceptional case, a mantissa part data, in which all of the bits are "1", is obtained as a result of the arithmetic processing, as shown in FIG. 1 (A). If such a mantissa part data is incremented by "1" by the rounding operation, the incremented data overflows the most significant bit of the mantissa part so that all of the bits in the mantissa part become "0" as shown in FIG. 1 (B). Thus an adjustment must be made to the mantissa part and to the exponent part. That is, the mantissa part must be a constant value in which the most significant bit is "1" and the other bits are "0", while the exponent part is incremented by "1" as shown in FIG. 1 (C).
Accordingly, the rounding operation must always be conducted to cover such an exception.
In the prior art, the rounding operation is conducted following to an operation flow shown in FIG. 2.
First, it should be judged whether the rounding operation is raising or truncating. If the operation is raising, the mantissa part M.sub.B is incremented by "1" and then it is also judged whether or not a carry occurs due to the increment of the mantissa part M.sub.B. These operations have been conducted by a program in the prior art. But, in the case of processing a number of floating point data, checking operation of a carry signal must be conducted each time the increment operation of the mantissa part is conducted, even if the exception described above rarely occurs. Then, the period of time for the rounding operation is prolonged because of the checking of the carry signal.
Further, in case a carry occurs as a result of the increment of the mantissa part, both the mantissa part and the exponent part must be adjusted, which further prolongs the period of time for the rounding operation.